<extend name="./common" />
<block name='css'>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/static/highlightJS/styles/<?php echo !isset(F('webSet')['codestyle'])?'solarized_dark':F('webSet')['codestyle'];?>.css">
<link rel="stylesheet" href="__PUBLIC__/static/home/barrager/css/barrager.css"/>
<style type="text/css">
  code{
    overflow-x:auto !important;
    white-space:pre !important;
    text-indent: 0!important;
  }
  pre {
    position: relative;
    margin-bottom: 24px;
    border-radius: 3px;
    border: 1px solid #C3CCD0;
    /*background: #000;*/
    overflow:hidden;
  }
  code.has-numbering {
    margin-left: 26px;
  }

  .pre-numbering {
    list-style: none !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 26px;
    padding: 8px 3px 42px 3px;
    border-right: 1px solid #C3CCD0;
    /*border-radius: 3px 0 0 3px;*/
    background-color: #EEE;
    text-align: right;
    font-size: 1em;
    color: #666;
  }
  .pre-numbering>li{text-indent: 0;}
</style>
</block>
  <block name="content">
  <div class="modal fade" id="replayMsgBox" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">回复:<span id="toname"></span></h4>
            </div>
            <form id="replayMsgForm" method="post" class="form-inline" action="">
              <div class="modal-body">
                
          <div class="comment-title">
            <div class="form-group">
              <label for="commentName">昵称：</label>
              <input type="text" name="nickname" <if condition="F('webSet')['qqLogin'] eq 1"> readonly="readonly"</if> class="form-control" id="replaynickname" placeholder="张三" value="<?php echo session('visitor')['nickname'];?>">
            </div>
            <div class="form-group">
              <label for="commentEmail">邮箱：</label>
              <input type="text" name="email" class="form-control" id="replayemail" placeholder="留下邮箱便于收到回复">
            </div>
          </div>
          <input type="hidden" name="to" value="" id="replay_id_to">
          <div class="comment-title">
            <div class="form-group">
              <label for="commentName">验证：</label>
              <input type="text" name="code" placeholder="验证码" maxlength="4" class="form-control" id="replaycode">
            </div>
            <div class="form-group">
              <img style="display: inline;border: 1px solid #ccc;" src="__CONTROLLER__/verify" class="comment-form-text"  onclick="this.src='__CONTROLLER__/verify/'+Math.random()" id="verifyImg" style="height: 34px">
              <span style="line-height: 34px;    margin-left: 10px;">点击图片切换</span>
            </div>
          </div>
           <div class="comment-title">
            <div>
            <input type="hidden" name="article_id" value="{$article['id']}">
              <label for="commentName">评论：</label>
            <textarea placeholder="你的评论可以一针见血" name="comment" id="replaymessage" style="width: 100%;" class="form-control" rows="5"></textarea>
            </div>
          </div>
              </div>
              <div class="modal-footer">
                  <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                  <button type="submit" class="btn btn-primary">提交更改</button>
              </div>
            </form>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

  <div class="content-wrap"><!--内容-->
    <div class="content">
      <header class="news_header">
        <h2>{$article['title']}</h2>
        <ul>
          <li>{$user} 发布于 {$article['create_time']|date='Y-m-d H:i:s',###}</li>
          <li>分类：<a href="{:U('index/articles/cid/'.$article['category_id'])}" title="" target="_blank">{$article['category']}</a></li>
          <li>共 <strong>{$article['views']}</strong> 人围观 </li>
          <li><strong id="likes0">{$article['likes']}</strong> 人喜欢</li>
          <li onclick="showqrimg()" class="hidden-xs" style="cursor:pointer;float: right;"><span class="glyphicon glyphicon-qrcode"></span><span>&nbsp; 手机查看</span></li>
        </ul>
      </header>
      <article class="news_content">
      {$article['content']|htmlspecialchars_decode}
      </article>
      <div class="reprint">转载请说明出处：<a href="{:U('index')}" title="{:F('webSet')['webtitle']}" target="_blank">{:F('webSet')['webtitle']}</a> » <a href="" title="" target="_blank">{$article['title']}</a></div>
      <div class="zambia">
      <a href="javascript:;" name="zambia"  onclick="zan({$article['id']})">
      <span class="glyphicon glyphicon-thumbs-up"></span> 赞（<span id="likes">{$article['likes']}</span>）</a></div>
      <div class="tags news_tags">标签： 
      <?php 
          $tags=explode(',',$article['tags']);
          foreach($tags as $tag){
            echo "<span data-toggle='tooltip' data-placement='bottom' title='查看关于 $tag 的文章'>
            <a href='".U('index/articles/tag/'.$tag)."'>$tag</a></span> ";
          }
      ?>
      </div>
      <nav class="page-nav"> 
      <span class="page-nav-prev">上一篇<br />
      <if condition="!empty($prevNext[0])">
        <a href="{:U('index/article/id/'.$prevNext[0]['id'])}" rel="prev" title="{$prevNext[0]['title']}">{$prevNext[0]['title']|mb_substr=###,0,15,'utf-8'}...</a>
          <else />
          -_-! 没有上一篇了~
        </if>
        </span>
         <span class="page-nav-next">下一篇<br />
         <if condition="!empty($prevNext[1])">
          <a href="{:U('index/article/id/'.$prevNext[1]['id'])}" rel="prev" title="{$prevNext[1]['title']}">{$prevNext[1]['title']|mb_substr=###,0,15,'utf-8'}...</a>
          <else />
          -_-! 没有下一篇了~
        </if>
        </span> </nav>

      <div class="content-block related-content visible-lg visible-md">
        <h2 class="title"><strong>相关推荐</strong></h2>
        <ul>
          <foreach name='recommendations' item='reco'>
            <li>
              <a target="_blank" href="{:U('index/article/id/'.$reco['id'])}">
              <img <empty name='reco.cover'>src='__PUBLIC__/static/admin/i/1.jpg'<else />  src="
              <?php
                if(file_exists('.'.$reco['cover'])){
                  echo $reco['cover'];
                }else{
                  echo "__PUBLIC__/static/admin/i/1.jpg";
                }
              ;?>
              "</empty> alt=" {$reco['title']}">
              <h3> {$reco['title']} </h3>
              </a>
            </li>
          </foreach>
        </ul>
      </div>
      <div class="content-block comment">
        <h2 class="title"><strong>评论</strong></h2>
        <form action="" method="post" class="form-inline" id="comment-form">
          <div class="comment-title">
            <div class="form-group">
              <label for="commentName">昵称：</label>
              <input type="text" name="nickname" class="form-control" id="nickname" placeholder="张三" <if condition="F('webSet')['qqLogin'] eq 1"> readonly="readonly"</if> value="<?php echo session('visitor')['nickname'];?>">
            </div>
            <div class="form-group">
              <label for="commentEmail">邮箱：</label>
              <input type="email" name="email" class="form-control" id="email" placeholder="留下邮箱便于收到回复">
            </div>
          </div>
          <div class="comment-title">
            <div class="form-group">
              <label for="commentName">验证：</label>
              <input type="text" name="nickname" placeholder="验证码" maxlength="4" class="form-control" id="code">
            </div>
            <div class="form-group">
              <img style="display: block;border: 1px solid #ccc;" src="__CONTROLLER__/verify" class="comment-form-text"  onclick="this.src='__CONTROLLER__/verify/'+Math.random()" id="verifyImg">
              <span style="    line-height: 37px;    margin-left: 10px;">点击图片切换</span>
            </div>
          </div>
          <div class="comment-form">
            <textarea placeholder="你的评论可以一针见血" name="comment" id="comment"></textarea>
            <div class="comment-form-footer">
              <if condition="F('webSet')['qqLogin'] eq 1">
              <div class="comment-form-text" style="display: block;">
              <if condition="empty(session('visitor'))">
              未登录？
              <a onclick='toQzoneLogin()'><img src="__PUBLIC__/static/home/images/qqlogin.png"></a>
              <else />
              已登录：<?php echo session('visitor')['nickname'];?> 
              <a href="{:U('index/logout')}">&nbsp;【退出登录】</a>
              </if>
               </div>
               </if>
              <div class="comment-form-btn">
                <button type="submit" class="btn btn-default btn-comment">提交评论</button>
              </div>
            </div>
          </div>
        </form>
        <span style="display: none" id="nextpage">2</span>
        <div class="comment-content">
        <div class="c-comment-empty">
            还没有评论，快来抢沙发吧！
        </div>
          <ul class="commentul"></ul>
        </div>
      </div>
    </div>
  </div>

  </block>

  <block name='js'>
  <script type="text/javascript" src="__PUBLIC__/static/home/barrager/jquery.barrager.min.js"></script>
  <script type="text/javascript" src="__PUBLIC__/static/highlightJS/highlight.min.js"></script>
    <script>
      function showqrimg(){
        layer.open({
          type: 1,
          shade: false,
          title: false,
          content: '<img src="http://s.jiathis.com/qrcode.php?url=http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>">',
        });
      }
      hljs.initHighlightingOnLoad();//代码高亮
      do{
        if({$jsonComments}===null){
          break;
        }
        var looper_time=3*1000;
        var items={$jsonComments};
        var total={$jsonComments}.length;
        var run_once=true;
        var index=0;
        sss();
        function sss(){
          if(run_once){
              looper=setInterval(sss,looper_time);                
              run_once=false;
          }
          $('body').barrager(items[index]);
          index++;
          if(index == total){
              clearInterval(looper);
              return false;
          }
        }
      }while(false);
    </script>
  <script type="text/javascript">
    function toQzoneLogin() {
       var _url='/index/qqlogin';  //转向网页的地址; 
       var name='TencentLogin';    //网页名称，可为空; 
       var iWidth=450; //弹出窗口的宽度; 
       var iHeight=320;   //弹出窗口的高度; 
       //获得窗口的垂直位置 
       var iTop = (window.screen.availHeight - 30 - iHeight) / 2; 
       //获得窗口的水平位置 
       var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; 
       window.open(_url, name, 'height=' + iHeight +
        ',innerHeight=' + iHeight + ',width=' + iWidth +
         ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + 
         ',status=1,toolbar=no,menubar=no,location=1,resizable=no,scrollbars=0,titlebar=no');
    }
  </script>
  <script type="text/javascript">
    $(function(){
      $('pre code').each(function(){
          var lines = $(this).text().split('\n').length - 1;
          var $numbering = $('<ul/>').addClass('pre-numbering');
          $(this)
              .addClass('has-numbering')
              .parent()
              .append($numbering);
          for(i=1;i<=lines+1;i++){
            $numbering.append($('<li/>').text(i));
          }
      });
      /*获取评论*/
      $.post('{:U("index/getComments")}',{'acid':<?php echo $article['id'];?>},function(res){
        var html=str=avatar='';
        if(res.length==0){
          $(".c-comment-empty").css('display', 'block');
        }else{
        
        $.each(res,function(i){
  if(parseInt(res[i].to)!=0 && parseInt(res[i].is_admin)==1){
    /*站长回复的人*/
      str='回复'+res[i].replay;
      res[i].nickname='站长';
      avatar='__PUBLIC__/static/home/images/readerAvatar.png';
  }else if(parseInt(res[i].to)!=0 && parseInt(res[i].is_admin)==0){
      // replay_admin
      if(res[i].replay_admin==1){
       res[i].replay='站长';
      }
      str='回复'+res[i].replay;
      <if condition="F('webSet')['qqLogin'] eq 1">
        if(res[i].avatar!=null){
          avatar=res[i].avatar;
        }else{
          avatar='__PUBLIC__/static/home/images/avatars/'+parseInt(res[i].id)%10+'.jpg';
        }
      <else />
        avatar='__PUBLIC__/static/home/images/avatars/'+parseInt(res[i].id)%10+'.jpg';
      </if>
  }else{
    str='';
    <if condition="F('webSet')['qqLogin'] eq 1">
      if(res[i].avatar!=null){
        avatar=res[i].avatar;
      }else{
        avatar='__PUBLIC__/static/home/images/avatars/'+parseInt(res[i].id)%10+'.jpg';
      }
    <else />
      avatar='__PUBLIC__/static/home/images/avatars/'+parseInt(res[i].id)%10+'.jpg';
    </if>
  }
  html+='<div class="am-comment"><a href="javascript:;"><img src="'+avatar+'" class="am-comment-avatar" width="36" height="36"></a><div class="am-comment-main"><header class="am-comment-hd"><div class="am-comment-meta"><a href="javascript:;" class="am-comment-author">';
  html+=res[i].nickname+'</a>'+str+'&nbsp;&nbsp;<span class="hidden-xs">';
  html+='设备：'+res[i].systemos+'&nbsp;&nbsp;&nbsp;浏览器：'+res[i].browser+'&nbsp;&nbsp;&nbsp;</span><time datetime="'+res[i].create_time+'">'+res[i].create_time+'</time></div></header><div class="am-comment-bd">';

  if(parseInt(res[i].to)!=0){
    if(parseInt(res[i].replay_admin)==1){
      var avatar2='__PUBLIC__/static/home/images/readerAvatar.png';
      res[i].replay='站长';
    }else{
      <if condition="F('webSet')['qqLogin'] eq 1">
        if(res[i].replay_a!=null){
          var avatar2=res[i].replay_a;
        }else{
          var avatar2='__PUBLIC__/static/home/images/avatars/'+parseInt(res[i].to)%10+'.jpg';
        }
      <else />
        var avatar2='__PUBLIC__/static/home/images/avatars/'+parseInt(res[i].to)%10+'.jpg';
      </if>  
    }
  
  html+='<div class="am-comment"><a href="javascript:;"><img src="'+avatar2+'" class="am-comment-avatar" width="36" height="36"></a><div class="am-comment-main"><header class="am-comment-hd"><div class="am-comment-meta"><a href="javascript:;" class="am-comment-author">';
  html+=res[i].replay+'</a>&nbsp;&nbsp;<span class="hidden-xs">';
  html+='设备：'+res[i].replay_systemos+'&nbsp;&nbsp;&nbsp;浏览器：'+res[i].replay_browser+'&nbsp;&nbsp;&nbsp;</span><time datetime="'+res[i].replay_create_time+'">'+res[i].replay_create_time+'</time></div></header><div class="am-comment-bd">'+res[i].replay_com+'</div><footer class="am-comment-footer"><div class="am-comment-actions"><a class="glyphicon glyphicon-thumbs-up" onclick="CommentUpDown('+res[i].to+',1,0)">点赞[<span class="up_'+res[i].to+'">'+res[i].replay_upc+'</span>]</a><a class="glyphicon glyphicon-thumbs-down" onclick="CommentUpDown('+res[i].to+',0,0)">踩[<span class="down_'+res[i].to+'">'+res[i].replay_downc+'</span>]</a><a class="glyphicon glyphicon-share-alt" onclick="replayMsg('+res[i].to+',\''+res[i].replay+'\')">回复</a></div></footer></div></div>';
}
html+=res[i].comment+'</div><footer class="am-comment-footer"><div class="am-comment-actions"><a class="glyphicon glyphicon-thumbs-up" onclick="CommentUpDown('+res[i].id+',1,0)">点赞[<span class="up_'+res[i].id+'">'+res[i].upc+'</span>]</a><a class="glyphicon glyphicon-thumbs-down" onclick="CommentUpDown('+res[i].id+',0,0)">踩[<span class="down_'+res[i].id+'">'+res[i].downc+'</span>]</a><a class="glyphicon glyphicon-share-alt"  onclick="replayMsg('+res[i].id+',\''+res[i].nickname+'\')">回复</a></div></footer></div></div>';

        });
      }
        $(".commentul").prepend($(html).fadeIn(300));
      });
    });

    // 点赞，点踩 s踩：0，赞1，m=1 message
    function CommentUpDown(id,s,m){
      var account1= $.cookie('message_up_id_'+id+'_m_'+m);
      var account2= $.cookie('message_down_id_'+id+'_m_'+m);
      if(s==1){
        if(account1=='1'){
          layer.msg("已经点过赞了");
          return false;
        }
      }else{
        if(account2=='1'){
          layer.msg("已经点过踩了");
          return false;
        }
      }
      var pdata={'id':id,'s':s,'m':m};
      $.post('{:U("__CONTROLLER__/commentUpDow")}',pdata,function(res){
        if(res.status){
          if(s==1){
            $(".up_"+id).each(function(index, el) {
              $(el).text(parseInt($(el).text())+1);
            });
            $.cookie('message_up_id_'+id+'_m_'+m,1,{expires:30*3600*24}); 
          }else{
            $(".down_"+id).each(function(index, el) {
             $(el).text(parseInt($(el).text())+1);
            });
            $.cookie('message_down_id_'+id+'_m_'+m,1,{expires:30*3600*24});
          }
          layer.msg(res.msg);
        }else{
          layer.msg(res.msg);
        }
      })
    }
    // 回复
    function replayMsg(id,toname){
      $("#toname").text(toname);
      $("#replay_id_to").val(id);
      $('#replayMsgBox').modal();
    }
    $("#replayMsgForm").submit(function(){
      var pdata=$(this).serialize();
      $.post('{:U("__CONTROLLER__/addComment")}',pdata,function(res){
        if(res.status){
          location.reload();
        }else{
          layer.alert(res.msg,{icon:5});
        }
      });
      return false;
    })

    function htmlspecialchars(str){            
      str = str.replace(/&/g, '&amp;');  
      str = str.replace(/</g, '&lt;');  
      str = str.replace(/>/g, '&gt;');  
      str = str.replace(/"/g, '&quot;');  
      str = str.replace(/'/g, '&#039;');  
      return str;  
    } 
    //相关推荐
    $(function(){
      $(".related-content ul li").hover(function(){
        $(this).find("h3").show();
      },function(){
        $(this).find("h3").hide();
      });
    });
    function zan(id){
      var account= $.cookie('name_'+id);
      if(account=='1'){
        layer.msg("已经点过赞了");
        return false;
      }
      $.post('{:U("index/likeplus")}',{'id':id},function(res){
        if(res.status){
          $.cookie('name_'+id,1,{expires:30*3600*24});
          layer.msg(res.msg);
          $("#likes").text(parseInt($("#likes").text())+1);
          $("#likes0").text(parseInt($("#likes0").text())+1);
        }else{
          layer.alert(res.msg);
        }
      })
    }

    $("#comment-form").submit(function(){
      var nickname=$.trim($("#nickname").val());
      var email=$("#email").val();
      var comment=$.trim($("#comment").val());
      var code=$("#code").val();
      if(comment==''){
        layer.alert('评论不能为空');
        return false;
      }
      var aid={$article['id']};
      $.post('{:U("__CONTROLLER__/addComment")}',{'nickname':nickname,'email':email,'comment':comment,'article_id':aid,'code':code},function(res){
        if(res.status){
          
          <if condition="F('webSet')['qqLogin'] eq 1">
          var avatar='<?php echo session("visitor")["figureurl_1"];?>';
          <else />
          var avatar='__PUBLIC__/static/home/images/avatars/'+parseInt(res.sid)%10+'.jpg';
          </if>
          var html='<div class="am-comment"><a href="javascript:;"><img src="'+avatar+'" class="am-comment-avatar" width="36" height="36"></a><div class="am-comment-main"><header class="am-comment-hd"><div class="am-comment-meta"><a href="javascript:;" class="am-comment-author">';
          html+=nickname+'</a>&nbsp;&nbsp;<span class="hidden-xs">';
          html+='设备：'+res.systemos+'&nbsp;&nbsp;&nbsp;浏览器：'+res.browser+'&nbsp;&nbsp;&nbsp;</span><time datetime="'+res.create_time+'">'+res.create_time+'</time></div></header><div class="am-comment-bd">'+htmlspecialchars(comment)+'</div><footer class="am-comment-footer"><div class="am-comment-actions"><a class="glyphicon glyphicon-thumbs-up" onclick="CommentUpDown('+res.sid+',1,0)">点赞[<span class="up_'+res.sid+'">0</span>]</a><a class="glyphicon glyphicon-thumbs-down" onclick="CommentUpDown('+res.sid+',0,0)">踩[<span class="down_'+res.sid+'">0</span>]</a><a class="glyphicon glyphicon-share-alt">回复</a></div></footer></div></div>';

          $(".c-comment-empty").css('display', 'none');
          $(".commentul").prepend($(html).fadeIn(400));
          layer.msg('评论成功');
        }else{
          $("#verifyImg").attr('src', '__CONTROLLER__/verify/'+Math.random());
          layer.alert(res.msg);
        }
      });
      return false;
    });

    flag=true;
    //滚动条到页面底部加载更多案例 
    $(window).scroll(function(){
      var scrollTop = $(this).scrollTop();    //滚动条距离顶部的高度
      var scrollHeight = $(document).height();   //当前页面的总高度
      var clientHeight = $(this).height();    //当前可视的页面高度
      if(scrollTop + clientHeight >= scrollHeight){ 
        /*翻页*/
        var page=$('#nextpage').text();
        next(page);
      }else if(scrollTop<=0){ 

      }
    });
    function next (p){
      if (p > {$pageCount}){
        if(flag){
          var foot='<hr><h5 style="text-align:center;color:#aaa">已经到底了</h5>';
          $(".commentul").append($(foot).fadeIn(400));
          flag=false;
        }
        return false;
      }
      // layer.msg('请稍等，正在加载...');
      var _url = '{:U("index/getComments")}';
      if (p <= {$pageCount}){
        $('#nextpage').text(parseInt(p)+1);
      }
      jQuery.ajax({
        type : "POST",
        url : _url,
        data:{
          'p':p,
          'acid':<?php echo $article['id'];?>
        },
        success : function (res){
          // 渐显新内容
          jQuery(function (){
            var html=str=avatar='';

                    $.each(res,function(i){
  if(parseInt(res[i].to)!=0 && parseInt(res[i].is_admin)==1){
    /*有回复的人*/
      str='回复'+res[i].replay;
      res[i].nickname='站长';
      avatar='__PUBLIC__/static/home/images/readerAvatar.png';
  }else if(parseInt(res[i].to)!=0 && parseInt(res[i].is_admin)==0){
    // replay_admin
    if(res[i].replay_admin==1){
     res[i].replay='站长';
    }
    str='回复'+res[i].replay;
    <if condition="F('webSet')['qqLogin'] eq 1">
      if(res[i].avatar!=null){
        avatar=res[i].avatar;
      }else{
        avatar='__PUBLIC__/static/home/images/avatars/'+parseInt(res[i].id)%10+'.jpg';
      }
    <else />
      avatar='__PUBLIC__/static/home/images/avatars/'+parseInt(res[i].id)%10+'.jpg';
    </if>
  }else{
    str='';
    <if condition="F('webSet')['qqLogin'] eq 1">
      if(res[i].avatar!=null){
        avatar=res[i].avatar;
      }else{
        avatar='__PUBLIC__/static/home/images/avatars/'+parseInt(res[i].id)%10+'.jpg';
      }
    <else />
      avatar='__PUBLIC__/static/home/images/avatars/'+parseInt(res[i].id)%10+'.jpg';
    </if>
  }
  html+='<div class="am-comment"><a href="javascript:;"><img src="'+avatar+'" class="am-comment-avatar" width="36" height="36"></a><div class="am-comment-main"><header class="am-comment-hd"><div class="am-comment-meta"><a href="javascript:;" class="am-comment-author">';
  html+=res[i].nickname+'</a>'+str+'&nbsp;&nbsp;<span class="hidden-xs">';
  html+='设备：'+res[i].systemos+'&nbsp;&nbsp;&nbsp;浏览器：'+res[i].browser+'&nbsp;&nbsp;&nbsp;</span><time datetime="'+res[i].create_time+'">'+res[i].create_time+'</time></div></header><div class="am-comment-bd">';

  if(parseInt(res[i].to)!=0){
    if(parseInt(res[i].replay_admin)==1){
      var avatar2='__PUBLIC__/static/home/images/readerAvatar.png';
      res[i].replay='站长';
    }else{
      <if condition="F('webSet')['qqLogin'] eq 1">
        if(res[i].replay_a!=null){
          var avatar2=res[i].replay_a;
        }else{
          var avatar2='__PUBLIC__/static/home/images/avatars/'+parseInt(res[i].to)%10+'.jpg';
        }
      <else />
        var avatar2='__PUBLIC__/static/home/images/avatars/'+parseInt(res[i].to)%10+'.jpg';
      </if>  
    }
  
  html+='<div class="am-comment"><a href="javascript:;"><img src="'+avatar2+'" class="am-comment-avatar" width="36" height="36"></a><div class="am-comment-main"><header class="am-comment-hd"><div class="am-comment-meta"><a href="javascript:;" class="am-comment-author">';
  html+=res[i].replay+'</a>&nbsp;&nbsp;<span class="hidden-xs">';
  html+='设备：'+res[i].replay_systemos+'&nbsp;&nbsp;&nbsp;浏览器：'+res[i].replay_browser+'&nbsp;&nbsp;&nbsp;</span><time datetime="'+res[i].replay_create_time+'">'+res[i].replay_create_time+'</time></div></header><div class="am-comment-bd">'+res[i].replay_com+'</div><footer class="am-comment-footer"><div class="am-comment-actions"><a class="glyphicon glyphicon-thumbs-up" onclick="CommentUpDown('+res[i].to+',1,0)">点赞[<span class="up_'+res[i].to+'">'+res[i].replay_upc+'</span>]</a><a class="glyphicon glyphicon-thumbs-down" onclick="CommentUpDown('+res[i].to+',0,0)">踩[<span class="down_'+res[i].to+'">'+res[i].replay_downc+'</span>]</a><a class="glyphicon glyphicon-share-alt" onclick="replayMsg('+res[i].to+',\''+res[i].replay+'\')">回复</a></div></footer></div></div>';
}
html+=res[i].comment+'</div><footer class="am-comment-footer"><div class="am-comment-actions"><a class="glyphicon glyphicon-thumbs-up" onclick="CommentUpDown('+res[i].id+',1,0)">点赞[<span class="up_'+res[i].id+'">'+res[i].upc+'</span>]</a><a class="glyphicon glyphicon-thumbs-down" onclick="CommentUpDown('+res[i].id+',0,0)">踩[<span class="down_'+res[i].id+'">'+res[i].downc+'</span>]</a><a class="glyphicon glyphicon-share-alt"  onclick="replayMsg('+res[i].id+',\''+res[i].nickname+'\')">回复</a></div></footer></div></div>';

        });

            $(".commentul").append($(html).fadeIn(300));
          layer.closeAll();
          });
        }
      });
    }
  </script>
  </block>